package JavaBase;
/*
9、类的设计
该系统中必须包括两个类，类名及属性设置如下。
雇员类(Employee)
名称(name)
工资(salary)
加班补贴(subsidy)
所得税输入类(IncomeTax)
10、具体要求及推荐实现步骤
	1、创建雇员类。
	2、设计雇员类的计算所得税的方法。
	3、设计所得税输入类，从控制台获得输入信息。
4、所得税的计算公式如下：
税前收入=工资+加班补贴
税后收入=税前收入-所得税额
所得税额 = 应纳税额 * 税
当税前收入小于3500元时，应纳税额为0元；当税前收入大于等于3500元时，应纳税额是税前收入-3500
税率的规则如下：
应纳税额	税率
0-500元	5%
500-2000元	10%
2000-5000元	15%
5000-20000元	20%
20000元以上	30%

 */
public class Employee {
    private String name;
    private double salary;
    private double subsidy;
    private double taxBefore;
    private double taxAfter;
    private double tax;
    public double tax()
    {
        this.taxBefore=this.salary+this.subsidy;
        double dif=this.taxBefore-3500;
        if(dif<0)
        {
            this.tax=0;
        }
        else if(dif>=0&&dif<500)
        {
            this.tax=0.05;
        }
        else if(dif>=500&&dif<2000)
        {
            this.tax=0.1;
        }
        else if(dif>=2000&&dif<5000)
        {
            this.tax=0.15;
        }
        else if(dif>=5000&&dif<20000)
        {
            this.tax=0.2;
        }
        else if(dif>=20000)
        {
            this.tax=0.3;
        }
        return this.tax;

    }

    public double getTaxAfter() {
        return taxAfter;
    }

    public double getTax() {
        return tax;
    }

    public double getTaxBefore() {
        return taxBefore;
    }

    public void setTax(double tax) {
        this.tax = tax;
    }

    public void setTaxAfter(double taxAfter) {
        this.taxAfter = taxAfter;
    }

    public void setTaxBefore(double taxBefore) {
        this.taxBefore = taxBefore;
    }

    public Employee()
    {
        this.name="小李";
        this.salary=5000;
        this.subsidy=1500;
        this.taxBefore=1000;
        this.taxAfter=2000;
        this.tax=0;
    }
    public Employee(String name,double salary,double subsidy,double taxAfter,double taxBefore,double tax)
    {
        this.name=name;
        this.salary=salary;
        this.subsidy=subsidy;
        this.tax=tax;
        this.taxAfter=taxAfter;
        this.taxBefore=taxBefore;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public double getSubsidy() {
        return subsidy;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public void setSubsidy(double subsidy) {
        this.subsidy = subsidy;
    }
    public void show()
    {
        System.out.println("姓名："+this.name);
        System.out.println("工资："+this.salary);
        System.out.println("加班补贴："+this.subsidy);
    }

}
